//用户-角色 关联

//删除*
import {transfer} from "./axiosApi";

export function DelUserRole(id) {
    return transfer({
        params: {id},
        url: '/role/del',
    })
}

// 添加*
export function RoleSave({name, nickname, permissions, id}) {
    return transfer({
        method: 'post',
        data: {name, nickname, permissions, id},
        url: '/role/save',
    })
}

//查询role*
export function QueryRole({page, size, condition}) {
    return transfer({
        method: 'post',
        data: {page, size, condition},
        url: '/role/page',
    })
}

//查询当前用户拥有的角色和权限*
export function HasRoles(userId) {
    return transfer({
        params: {userId},
        url: '/user_role/hasRoles',
    })
}

// 删除*
export function delUserRole(id) {
    return transfer({
        params: {id},
        url: '/user_role/del',
    })
}

//查找所有*
export function findAllRole(params) {
    return transfer({url: '/role/findAll', params},
    )
} //添加/修改*
export function addUserRole({userId, roleId,}) {
    return transfer({
        method: 'post',
        data: {userId, roleId},
        url: '/user_role/save',
    })
}